/*
* Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd.
*
* Maintainer: <changze@uniontech.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QtWidgets>

namespace Ui {
class MainWindow;
}

struct FunctionInfo{
    QString funcName;
    QStringList argNameList;
    uint start = 0;
    uint end = 0;
};

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

    QList<FunctionInfo> getFuncInfo(const QString &filepath);


    void fillModelByDir(const QString &dir);
    void fillModelByFile(const QString &filepath);
    void fillModel(const QString &dir);

    QString testFuncName(const QString &filePath, const FunctionInfo &info, bool &ok);
    int testFuncBody(const QString &filePath, const FunctionInfo &info);
private slots:
    void on_pushButton_openFolder_clicked();

    void on_pushButton_exit_clicked();


    void on_pushButton_refresh_clicked();

private:
    Ui::MainWindow *ui;
    QStandardItemModel *model;

    int caseCount = 0;
    int caseExpect = 0;
};
#endif // MAINWINDOW_H
